<script setup lang="ts">
import { useRouter } from 'vue-router';

const router = useRouter()

</script>

<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="200px">
        <el-scrollbar>
          <el-menu default-active="1">
            <el-menu-item index="1" @click="router.push('/')">
              <template #title>
                <div class="flex items-center">
                  <img h-5 w-5 src="../assets/home.svg" />
                  <span ml-2>浏览</span>
                </div>
              </template>
            </el-menu-item>
            <el-sub-menu index="2">
              <template #title>
                <img h-5 w-5 src="../assets/all-application.svg" />
                <span ml-2>网站源</span>
              </template>
              <el-menu-item index="2-1" @click="router.push('/sources')">网站源配置</el-menu-item>
            </el-sub-menu>
            <el-menu-item index="3" @click="router.push('/config')">
              <template #title>
                <div class="flex items-center">
                  <img h-5 w-5 src="../assets/setting-one.svg" />
                  <span ml-2>设置</span>
                </div>
              </template>
            </el-menu-item>
          </el-menu>
        </el-scrollbar>
      </el-aside>
      <el-container>
        <el-main>
          <slot />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style scoped>
.common-layout .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}

.common-layout .el-aside {
  color: var(--el-text-color-primary);
}

.common-layout .el-menu {
  border-right: none;
}

.common-layout .el-main {
  padding: 0;
}
</style>